/*for home.vue*/
import mypage from '../../src/components/home/mypage';
import workpage from '../../src/components/home/workpage';
import docpage from '../../src/components/home/docpage';
import footerInfos from '../../src/components/pageModule/footerInfos';
import cornerMenu from '../../src/components/pageModule/cornerFn';
import feedBack from '../../src/components/pageModule/feedBack';

export default{
  name: 'home',
  components: {
    mypage,
    workpage,
    docpage,
    footerInfos,
    cornerMenu,
    feedBack
  },
  watch: {
    $route(){
      // console.log(this.$route.path)
    }
  },
  created () {//监听导航的变化
    // console.log(this.$route.path,this.$route.query.name)
    this.routePath = this.$route.path;
    this.userName = unescape(localStorage.name);//从缓存中获取用户登录名字
  },
  data () {
    return {
      contenttext: '我的项目',//初始化展示
      nav:{
        '/home/index': '我的项目',
        '/home/docpage': '日常小记',
        '/home/workpage': '闲聊技术',
        '/home/index/itemsDetails': '我的项目 / 项目详情',//我的项目下面的项目详情
        '/home/workpage/articleDetails': '闲聊技术 / 文章详情'//闲聊技术下面的文章详情
      },
      feedBackShow: false, //初始化的时候隐藏掉意见反馈的弹窗
      showLogoutBox: false, //初始化的时候隐藏注销登录框
      userName: ''  //初始化用户登录名字				
    }
  },
  methods: {
    navBarClick: function (event){
      console.log(event)
    },
    showDataFromChild: function (str){
      // console.log(str)
      this.feedBackShow = str;
    },
    hideDataFromChild: function (str){
      this.feedBackShow = str;
    },
    showLogoutFn: function (){//处理注销登录按钮的显示和隐藏
      if(this.showLogoutBox){
        this.showLogoutBox = false;
      }else{
        this.showLogoutBox = true;
      }
    },
    backLoginFn: function (){//点击注销登录返回登录页
      console.log('1231321321')
      window.location.href = '/login';
    }
  }
}